package com.swinboo.im.api;

import com.easemob.im.server.model.EMUser;
import com.huang.entity.result.HCollectionResult;
import com.huang.entity.result.HStringResult;
import com.swinboo.im.entity.param.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author Swinboo
 * @date 2022-03-17 21:29
 * @description:
 */

public interface EMUserApi {
    /**
     * 创建用户
     *
     * @return
     */
    @PostMapping("/im/user/create")
    HStringResult<EMUser> create(@RequestBody CreateEMUserParam createEMUserParam);

    /**
     * 删除用户
     *
     * @param deleteEMUserParam
     */
    @PostMapping("/im/user/delete")
    HStringResult delete(@RequestBody DeleteEMUserParam deleteEMUserParam);

    /**
     * 删除所有用户
     *
     * @return
     */
    @PostMapping("/im/user/deleteAll")
    HCollectionResult<String> deleteAll();

//    /**
//     * 在所有设备强制下线
//     *
//     * @param username
//     */
//    void forceLogoutAllDevices(String username);
//
//    /**
//     * 在某设备轻质下线
//     *
//     * @param username
//     * @param resource
//     */
//    void forceLogoutOneDevice(String username, String resource);
//

    /**
     * 获取用户信息
     *
     * @param getEMUserInfoParam
     * @return
     */
    @PostMapping("/im/user/getEMUserInfo")
    HStringResult<EMUser> getEMUserInfo(@RequestBody GetEMUserInfoParam getEMUserInfoParam);

    /**
     * 获取用户在线状态
     *
     * @param isEMUserOnlineParam
     * @return
     */
    @PostMapping("/im/user/isUserOnline")
    HStringResult<Boolean> isUserOnline(@RequestBody IsEMUserOnlineParam isEMUserOnlineParam);

    /**
     * 获取所有用户
     *
     * @return
     */
    @PostMapping("/im/user/listAllUsers")
    HCollectionResult<String> listAllUsers();

    /**
     * 分页获取用户
     *
     * @param listEMUsersParam
     * @return
     */
    @PostMapping("/im/user/listUsers")
    HCollectionResult listUsers(@RequestBody ListEMUsersParam listEMUsersParam);

    /**
     * 更新用户密码
     *
     * @param upadteEMUserPasswordParam
     * @return
     */
    @PostMapping("/im/user/updateUserPassword")
    HStringResult<Boolean> updateUserPassword(@RequestBody UpadteEMUserPasswordParam upadteEMUserPasswordParam);

}

